<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Keyboard Events</title>
		<link rel="stylesheet" href="../CSS/style.css">
	</head>

	<body>
		<h1>My page</h1>
		<canvas id="canvas" width="400" height="400"></canvas>
		<!--<script src="../javascript/utils.js"></script>-->
		<script src="../javascript/keycode.js"></script>
		<script>
			window.onload = function () {	
			
				/*function onKeyboardEvent(event){
					console.log(event.type);
				}
				window.addEventListener('keydown', onKeyboardEvent, false);
				window.addEventListener('keyup', onKeyboardEvent, false);*/
				
				/*function onKeyboardEvent (event) {
					switch (event.keyCode) {
						case 38:
						console.log("up!");
						break;
						case 40:
						console.log("down!");
						break;
						case 37:
						console.log("left!");
						break;
						case 39:
						console.log("right!");
						break;
						default:
						console.log(event.keyCode);
					}
				}
				window.addEventListener('keydown', onKeyboardEvent, false);*/
					
			function onKeyboardEvent (event) {
				switch (event.keyCode) {
					case keycode.UP:
						console.log("up!");
						break;
					case keycode.DOWN:
						console.log("down!");
						break;
					case keycode.LEFT:
						console.log("left!");
						break;
					case keycode.RIGHT:
						console.log("right!");
						break;
					default:
						console.log(event.keyCode);
				}
			}
			window.addEventListener('keydown', onKeyboardEvent, false);
		};
		</script>
	</body>
</html>